package com.xintoucloud.pbs.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xintoucloud.pbs.dao.OrganizationStageDao;
import com.xintoucloud.pbs.entity.OrganizationStage;
import com.xintoucloud.pbs.model.OrganizationStageDto;
import com.xintoucloud.pbs.service.OrganizationStageService;
@Service@Transactional
public class OrganizationStageServiceImpl implements OrganizationStageService{
	
	@Autowired
	private OrganizationStageDao organizationStageDao;

	@Override
	public List<OrganizationStageDto> list() {
		List<OrganizationStage> organizationStage = organizationStageDao.list();
		List<OrganizationStageDto> list =new ArrayList<>();
		for (OrganizationStage organizationStages : organizationStage) {
			OrganizationStageDto organizationStageDto = new OrganizationStageDto();
			organizationStageDto.setOsgid(organizationStages.getOsgid());
			organizationStageDto.setOstage(organizationStages.getOstage());
			organizationStageDto.setDetail(organizationStages.getDetail());
			list.add(organizationStageDto);
		}
		return list;
		
	}

	@Override
	public void delete(int id) {
		organizationStageDao.delete(id);		
	}

	@Override
	public void update(OrganizationStage organizationStage) {
		organizationStageDao.update(organizationStage);
	}

}
